/*
 * @Author: Mr.Gao hansong_gao2022@163.com
 * @Date: 2025-03-31 18:35:19
 * @LastEditors: Mr.Gao hansong_gao2022@163.com
 * @LastEditTime: 2025-04-01 18:31:58
 * @FilePath: /test/ThreadPool/main.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include "ThreadPool.hpp"
#include "Task.hpp"
#include <memory>

int main()
{
    int cnt = 10;
    while(cnt)
    {
        //不断向线程池推送任务
        Task t(1, 1);
        ThreadPool<Task>::GetInstance()->Equeue(t);
        sleep(1);
        std::cout << "cnt: " << cnt-- << std::endl;
    }

    ThreadPool<Task>::GetInstance()->Stop();
    std::cout << "thread pool stop" << std::endl;
    sleep(10); //此时应该看到线程由6个变成一个

    return 0;
}